<template>
    <div class="footer-nav">
        <router-link 
            to="/frame" 
            class="nav-item" 
            v-slot="{ isActive }"
        >
            <div class="nav-content">
                <i class="nav-icon">🚲</i>
                <span :class="['nav-text', { active: isActive }]">车架</span>
                <div :class="['indicator', { active: isActive }]"></div>
            </div>
        </router-link>

        <router-link 
            to="/part" 
            class="nav-item"
            v-slot="{ isActive }"
        >
            <div class="nav-content">
                <i class="nav-icon">⚙️</i>
                <span :class="['nav-text', { active: isActive }]">零件</span>
                <div :class="['indicator', { active: isActive }]"></div>
            </div>
        </router-link>

        <router-link 
            to="/preview" 
            class="nav-item"
            v-slot="{ isActive }"
        >
            <div class="nav-content">
                <i class="nav-icon">👁️</i>
                <span :class="['nav-text', { active: isActive }]">预览</span>
                <div :class="['indicator', { active: isActive }]"></div>
            </div>
        </router-link>

        <router-link 
            to="/user" 
            class="nav-item"
            v-slot="{ isActive }"
        >
            <div class="nav-content">
                <i class="nav-icon">👤</i>
                <span :class="['nav-text', { active: isActive }]">我的</span>
                <div :class="['indicator', { active: isActive }]"></div>
            </div>
        </router-link>
    </div>
</template>

<script setup>

</script>

<style lang="css" scoped>
.footer-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 64px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -1px 10px rgba(0, 0, 0, 0.05);
    z-index: 100;
}

.nav-item {
    flex: 1;
    text-decoration: none;
    color: #64748b;
    position: relative;
    transition: all 0.3s ease;
}

.nav-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 0;
    position: relative;
}

.nav-icon {
    font-size: 24px;
    margin-bottom: 4px;
    transition: transform 0.3s ease;
}

.nav-text {
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-text.active {
    color: #3b82f6;
    transform: scale(1.05);
}

.indicator {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%) scale(0);
    width: 4px;
    height: 4px;
    border-radius: 2px;
    background: #3b82f6;
    transition: all 0.3s ease;
}

.indicator.active {
    transform: translateX(-50%) scale(1);
    width: 20px;
}

/* 活跃状态的图标动画 */
.nav-item:active .nav-icon {
    transform: scale(0.9);
}

/* 添加安全区域适配 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .footer-nav {
        height: calc(64px + env(safe-area-inset-bottom));
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* 添加动画效果 */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
}

.nav-item:hover .nav-icon {
    animation: bounce 0.5s ease;
}

/* 适配深色模式 */
@media (prefers-color-scheme: dark) {
    .footer-nav {
        background: rgba(30, 41, 59, 0.95);
        box-shadow: 0 -1px 10px rgba(0, 0, 0, 0.2);
    }

    .nav-text {
        color: #94a3b8;
    }

    .nav-text.active {
        color: #60a5fa;
    }

    .indicator {
        background: #60a5fa;
    }
}

/* 添加触摸反馈 */
@media (hover: none) {
    .nav-item:active {
        opacity: 0.7;
    }
}

/* 适配不同屏幕尺寸 */
@media screen and (min-width: 390px) {
    .nav-icon {
        font-size: 26px;
    }

    .nav-text {
        font-size: 13px;
    }
}

@media screen and (max-width: 320px) {
    .nav-icon {
        font-size: 22px;
    }

    .nav-text {
        font-size: 11px;
    }
}
</style>